/**
 * ReportGear(2011)
 */
package com.reportgear.report.print.pane;

import java.awt.BorderLayout;
import java.awt.Window;

import javax.swing.JTabbedPane;

import net.abbp.report.model.ReportModel;

import com.reportgear.core.swing.pane.base.JBasePane;

/**
 * 对话框-页面设置
 * 
 * @version 1.0 2011-4-20
 * @author <a herf="lexloo@gmail.com">lexloo</a>
 * @since Report 1.0
 */
public class PageSetupPane extends JBasePane {
    /**
     * UID
     */
    private static final long serialVersionUID = -3198806897384774174L;
    private PagePane pagePane;
    private PagingPage pagingPane;

    public PageSetupPane() {
        this.initComponents();
    }

    private void initComponents() {
        this.setLayout(new BorderLayout());

        JTabbedPane tabPane = new JTabbedPane();
        this.add(tabPane, BorderLayout.CENTER);

        this.pagePane = new PagePane();
        this.pagingPane = new PagingPage();

        tabPane.addTab("页面", this.pagePane);
        tabPane.addTab("分页", this.pagingPane);
    }

    public int showDialog(Window owner) {
        return this.showDialog(owner, "页面设置", 370, 440);
    }

    public void populate(ReportModel model) {
        if (model == null)
            return;

        this.pagePane.populate(model);
    }

    public void update(ReportModel model) {
        if (model == null)
            return;

        this.pagePane.update(model);
    }

    public boolean updatePageInfo() {
        return this.pagingPane.updatePageInfo();
    }
}